package model;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class TForumTitle {
	private int titleid;
	private String topic;
	private String serilize;
	private String querykey;
	private int recommandphoto;
	private int country;
	private int province;
	private int city;
	private int district;
	private String area;
	private String ipaddr;
	private String createtime;
	private int reviewcounter;
	private int scancounter;
	private boolean isdelete;
	private String userid;
	
	public TForumTitle(){
		
	}
	public TForumTitle(ResultSet rs){
		try {
			if(rs!=null && rs.next()){
				this.titleid = rs.getInt("titleid");
				this.topic = rs.getString("topic");
				this.serilize = rs.getString("serilize");
				this.querykey = rs.getString("querykey");
				this.recommandphoto = rs.getInt("recommandphoto");
				
				this.country = rs.getInt("country");
				this.province = rs.getInt("province");
				this.city = rs.getInt("city");
				this.district = rs.getInt("district");
				this.area = rs.getString("area");
				
				
				this.ipaddr = rs.getString("ipaddr");
				this.createtime = rs.getString("createtime");
				this.reviewcounter = rs.getInt("reviewcounter");				
				this.scancounter = rs.getInt("scancounter");
				this.isdelete = rs.getBoolean("isdelete");
				this.userid = rs.getString("userid");
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	public static List<TForumTitle> toList(ResultSet rs){
		List<TForumTitle> list = new ArrayList<TForumTitle>();
		if(rs!=null)
		{
			try {
				while (rs.next()) {
					TForumTitle user = new TForumTitle();
					user.titleid = rs.getInt("titleid");
					user.topic = rs.getString("topic");
					user.serilize = rs.getString("serilize");
					user.querykey = rs.getString("querykey");
					user.recommandphoto = rs.getInt("recommandphoto");
					
					user.country = rs.getInt("country");
					user.province = rs.getInt("province");
					user.city = rs.getInt("city");
					user.district = rs.getInt("district");
					user.area = rs.getString("area");
					
					
					user.ipaddr = rs.getString("ipaddr");
					user.createtime = rs.getString("createtime");
					user.reviewcounter = rs.getInt("reviewcounter");				
					user.scancounter = rs.getInt("scancounter");
					user.isdelete = rs.getBoolean("isdelete");
					user.userid = rs.getString("userid");
					list.add(user);
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return list;
		
	}
	
	public TForumTitle(int titleid, String topic, String serilize,
			String querykey, int recommandphoto, int country, int province,
			int city, int district, String area, String ipaddr, String createtime,
			int reviewcounter, int scancounter, boolean isdelete, String userid) {
		super();
		this.titleid = titleid;
		this.topic = topic;
		this.serilize = serilize;
		this.querykey = querykey;
		this.recommandphoto = recommandphoto;
		this.country = country;
		this.province = province;
		this.city = city;
		this.district = district;
		this.area = area;
		this.ipaddr = ipaddr;
		this.createtime = createtime;
		this.reviewcounter = reviewcounter;
		this.scancounter = scancounter;
		this.isdelete = isdelete;
		this.userid = userid;
	}

	public int getTitleid() {
		return titleid;
	}

	public void setTitleid(int titleid) {
		this.titleid = titleid;
	}

	public String getTopic() {
		return topic;
	}

	public void setTopic(String topic) {
		this.topic = topic;
	}

	public String getSerilize() {
		return serilize;
	}

	public void setSerilize(String serilize) {
		this.serilize = serilize;
	}

	public String getQuerykey() {
		return querykey;
	}

	public void setQuerykey(String querykey) {
		this.querykey = querykey;
	}

	public int getRecommandphoto() {
		return recommandphoto;
	}

	public void setRecommandphoto(int recommandphoto) {
		this.recommandphoto = recommandphoto;
	}

	public int getCountry() {
		return country;
	}

	public void setCountry(int country) {
		this.country = country;
	}

	public int getProvince() {
		return province;
	}

	public void setProvince(int province) {
		this.province = province;
	}

	public int getCity() {
		return city;
	}

	public void setCity(int city) {
		this.city = city;
	}

	public int getDistrict() {
		return district;
	}

	public void setDistrict(int district) {
		this.district = district;
	}

	public String getArea() {
		return area;
	}

	public void setArea(String area) {
		this.area = area;
	}

	public String getIpaddr() {
		return ipaddr;
	}

	public void setIpaddr(String ipaddr) {
		this.ipaddr = ipaddr;
	}

	public String getCreatetime() {
		return createtime;
	}

	public void setCreatetime(String createtime) {
		this.createtime = createtime;
	}

	public int getReviewcounter() {
		return reviewcounter;
	}

	public void setReviewcounter(int reviewcounter) {
		this.reviewcounter = reviewcounter;
	}

	public int getScancounter() {
		return scancounter;
	}

	public void setScancounter(int scancounter) {
		this.scancounter = scancounter;
	}

	public boolean isIsdelete() {
		return isdelete;
	}

	public void setIsdelete(boolean isdelete) {
		this.isdelete = isdelete;
	}

	public String getUserid() {
		return userid;
	}

	public void setUserid(String userid) {
		this.userid = userid;
	}
	
	
	
	
	
}
